package com.example.demos.mapper;

import com.example.demos.dto.ReturnOrderDetailsDTO;
import com.example.demos.dto.ReturnOrdersBySupplierNameDTO;
import com.example.demos.entity.Orders;
import com.example.demos.entity.ReturnOrderDetail;
import com.example.demos.entity.ReturnOrders;
import com.example.demos.entity.Store;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigInteger;
import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface ReturnOrdersMapper {
    int selectStoreSum();

    List<Store> selectStoreList();

    List<ReturnOrders> select(String state);

    int addReturnOrders(@Param("returnOrders") ReturnOrders returnOrders);

    int addReturnOrdersDetail(@Param("e") ReturnOrderDetailsDTO e,
                              @Param("uuid") BigInteger uuid,
                              @Param("state") String state);

    int doCheck(@Param("id") Integer id, @Param("returnOrders") ReturnOrders returnOrders);

    ReturnOrderDetail selectReturnOrderDetail(@Param("returnOrdersDetailUuid") BigInteger returnOrdersDetailUuid);


    int updateReturnOrderDetailEnd(@Param("returnOrdersDetailUuid") BigInteger returnOrdersDetailUuid,
                                   @Param("returnOrderDetail") ReturnOrderDetail returnOrderDetail);

    int selectReturnOrderDetailByReturnOrderUuid(@Param("returnOrdersUuid") BigInteger returnOrdersUuid);

    int updateReturnOrderByCount(@Param("now") LocalDateTime now,
                                 @Param("username")String username,
                                 @Param("returnOrdersUuid")BigInteger returnOrdersUuid);

    int updateStoreDetailByReturnOrderDetail(@Param("returnOrderDetail") ReturnOrderDetail returnOrderDetail);

    List<ReturnOrdersBySupplierNameDTO> selectReturnListByPage();

    int selectEmpIdByUsername(@Param("username") String username);

    void insertStoreOper(@Param("empId")int empId,
                         @Param("endTime")LocalDateTime endTime,
                         @Param("storeUuid") BigInteger storeUuid,
                         @Param("goodsUuid") BigInteger goodsUuid,
                         @Param("num") BigInteger num);
}
